/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

    Ext.QuickTips.init();
    
    var xg = Ext.grid;

    // shared reader
    var reader = new Ext.data.ArrayReader({}, [
       {name: 'id', tpye: 'string'},
       {name: 'kriterium', type: 'string'},
       {name: 'ria', type: 'string'},
       {name: 'bewerten', type: 'string'},
       {name: 'aktion', type: 'string'},
       {name: 'gruppe', type: 'string'}
    ]);

    var grid = new xg.GridPanel({
        store: new Ext.data.GroupingStore({
            reader: reader,
            data: xg.dummyData,
            sortInfo:{field: 'id', direction: "ASC"},
            groupField:'gruppe'
        }),

        columns: [
            {id:'id',header: "<center><b>id</b>", width: 50, sortable: true, dataIndex: 'id', css : "text-align : center;font-size:12px;align:center;"},
            {header: "<center><b>Kriterium</b>", width: 300, sortable: true, dataIndex: 'kriterium', css : "text-align : center;font-size:12px;align:center;"},
            {header: "<center><b>RIA</b>", width: 250, sortable: true, dataIndex: 'ria', css : "text-align : center;font-size:12px;align:center;"},
            {header: "<center><b>Bewerten</b>", width: 120, sortable: true, dataIndex: 'bewerten', css : "text-align : center;font-size:12px;align:center;"},
            {header: "<center><b>Aktion</b>", width: 100, sortable: true, dataIndex: 'aktion', css : "text-align : center;font-size:12px;align:center;"},
            {header: "<center><b>Gruppe</b>", width: 100, sortable: true, dataIndex: 'gruppe',css : "text-align : center;font-size:12px;align:center;"}
        ],

        view: new Ext.grid.GroupingView({
            forceFit:true,
			hideGroupedColumn: true,
			startCollapsed : true,
            groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Kriterien" : "Kriterium"]})'
        }),

        frame:true,
        width: 850,
        height: 550,
        collapsible: true,
        animCollapse: false,
        title: 'Bewertung abgeben',
        iconCls: 'icon-grid',
        renderTo:'grid-example'
    });
});



// Array data for the grids

